<template>
    <div>
        <el-dialog
            :title="$t('agent.accountMsg')"
            :visible="visibleInfo"
            class="el-dialog-lg"
            @close="()=>{$store.commit('setVisibleInfo',false)}">
            <baseTable v-loading="loading" row-key='sid' :data="dataRows" border  stripe :column='column'>
            </baseTable>
            <span slot="footer" class="dialog-footer">
                <el-button @click="()=>{$store.commit('setVisibleInfo',false)}">{{$t('close')}}</el-button>
            </span>
        </el-dialog>
    </div>
</template>

<script>
import baseTable from '../../components/common/baseTable'
import md5 from 'js-md5'
export default {
    components:{
        baseTable
    },
    props: {
        rowData:{
            type:Object,
            default:() => {return {}}
        }
    },
    data() {
        return {
            loading:false,
            dataRows:[],
            agentId:'',
            column:[{
                title: this.$t('devWifi.loginName'),
                value: 'loginName',
            },{
                title: this.$t('email'),
                value: 'email'
            }]
        };
    },
    computed: {
        visibleInfo(){
            return this.$store.state.sysStore.visibleInfo
        }
    },
    watch:{
        rowData:{
            handler(nv,ov){
                console.log(nv);
                if(nv){
                    this.agentId=nv.sid
                    this.initInfoTable()
                }
            }
        }
    },
    methods: {
        async initInfoTable(){
            if(this.agentId){
                this.loading = true
                let res = await this.API.getAllUserByAgent({
                    agentId:this.agentId
                })
                this.dataRows = res || []
                this.loading = false
            }
        },
    }
};
</script>

<style  lang="less">
</style>
